import request from '@/utils/request'


export const GetProductPageList = (pageNum,pageSize,productDto)=>{
    return request({
        url:`/admin/product/${pageNum}/${pageSize}`,
        method:'get',
        params:productDto
    })
}


export const SaveProduct = (product)=>{
    return request({
        url:`/admin/product/addProduct`,
        method:'post',
        data:product
    })
}




//根据spu的id查询当前商品对象，用于弹窗的回显
export const GetProductById = (spuId)=>{
    return request({
        url:`/admin/product/getByProductId/${spuId}`,
        method:'get',
    })
}


export const DeleteProductById = (spuId)=>{
    return request({
        url:`/admin/product/deleteById/${spuId}`,
        method:'delete',
    })
}

export const UpdateProductAuditStatus = (productId,auditStatus)=>{
    return request({
        url:`/admin/product/updateAuditStatus/${productId}/${auditStatus}`,
        method:'get',
    })
}



//两个方法的后端接口没有实现呢
export const UpdateProductById = (product)=>{
    return request({
        url:`/admin/product/updateProduct`,
        method:'post',
        data:product
    })
}


//spu上下架接口
export const UpdateProductStatus = (spuId,status)=>{
    return request({
        url:`/admin/product/updateStatus/${spuId}/${status}`,
        method:'get'
    })
}

//sku的上下架
export const UpdateSkuStatus = (skuId,status)=>{
    return request({
        url:`/admin/product/updateSkuStatus/${skuId}/${status}`,
        method:'get'
    })
}